import java.util.Objects;

public class Student {
    public int id;
    public String name;

    public int English;
    public int math;
    public int itGrade;
    private int sumGrade;

    public Student(int id, String name) {
        this.id = id;
        this.name = name;
    }
    public void setter(int math,int English,int itGrade) {
        this.math = math;
        this.English = English;
        this.itGrade = itGrade;
        sum();
    }
    public void setter(int English) {
        this.English = English;
        sum();
    }

    public void setter(int math,int English) {
        this.English = English;
        sum();
    }
    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", sumGrade=" + sumGrade +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return id == student.id;
    }
    public void  sum() {
        sumGrade =  this.math+this.English+this.itGrade;
    }
    public int compare(Student s1) {
        return this.sumGrade - s1.sumGrade;
    }

    /**
     * 计算平均分，学委+3，班长+5
     * @return
     */
    public int testScore() {
        return this.sumGrade/3;
    }

}
